package com.heima.wemedia.thread;

import com.heima.model.wemedia.pojos.WmMaterial;
import com.heima.model.wemedia.pojos.WmUser;

/**
 * @author 霍森彪
 * @date 2022/7/15 12:24
 */

public class UserThreadLocal {
//
    //定义一个threadlocal对象
    private static ThreadLocal<WmUser> userThreadLocal = new ThreadLocal<>();

    //定义get/set方法

    // 2. 为这个变量配置一对 get set方法
    public static WmUser get() {
        return userThreadLocal.get();
    }

    public static void set(WmUser wmUser) {
        userThreadLocal.set(wmUser);
    }
    //定义remove方法
    public static void remove(){
        userThreadLocal.remove();
    }
}
